package Game; 	
import java.awt.event.KeyEvent;

import Game.ManagerSound.Type;

  
 	public class PlayerSInvaders extends PlayerArkanoid {
 
 		private boolean move_left = false;
 		private boolean move_right = false;
 
 		private static final long serialVersionUID = 1L;
 
 
 		public PlayerSInvaders(float x, float y, int w, int h) {
 			super(x, y, w, h);
 			Load("/Imagens/PlayerSInvaders.png");
 		}
 
 		private boolean fire = false;
  
 		public void Update(InputManager input)
 
 	    {
 			if (input.ChecarTecla(KeyEvent.VK_LEFT))
 	    		move_left = true;
 			else
 				move_left = false;
 	    	
 			if (input.ChecarTecla(KeyEvent.VK_RIGHT))
 	    		move_right = true;
 	    	else
 	    		move_right = false;
 			
 	    	
 			if (move_left)
 				this.x -= 3;
 			
 			if (move_right)
 				this.x += 3;
 			
 	        if (this.x < 0)
 	            this.x = 0;
 	        if (this.x >= 800 - w)
 	        {
 	        	this.x = 800 - w;
 	        }
 			
 			
 	       if (input.ChecarTecla(KeyEvent.VK_SPACE) == true && fire == false)
 	       {
		 	    fire = true;
		 	    ShotManagerSInvaders.Add(this.x,this.y);
		 	    ManagerSound.getIntance().Play(Type.SHOT);
 	       }
 	      if (input.ChecarTecla(KeyEvent.VK_SPACE) == false)
	    		fire = false;
 		}
 	}